#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2019 crane <crane@gosun>
#
# Distributed under terms of the MIT license.

"""

"""

def replace(a, b):
    tmp = list(a)

    match_from_idx = 0

    while True:
        begin_idx = a.find(b, match_from_idx)

        if begin_idx == -1:
            break

        end_idx = begin_idx + len(b)

        for i in range(begin_idx, end_idx):
            tmp[i] = "*"

        match_from_idx = end_idx

    return "".join(tmp)


def test():
    ret = replace("asdfsdf", "sd")
    print(ret)

def main():
    print("match_from_idx main")
    test()

if __name__ == "__main__":
    main()
